package method;
/*
Thread.currentThread() 获取当前线程对象
 */
public class ThreadNameDemo2 {
    public static void main(String[] args) {
        MyRunnable mr = new MyRunnable();
        Thread t = new Thread(mr,"线程");
        //t.setName("线程");
        t.start();
        for (int i = 0; i <500 ; i++) {
            System.out.println(Thread.currentThread().getName()+i);
        }
    }
}
class MyRunnable implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i <200 ; i++) {
            System.out.println(Thread.currentThread().getName()+" "+i);
        }
    }
}
